package grape.wx.rest.mp.user.mvc;

import com.baomidou.mybatisplus.core.metadata.IPage;
import grape.common.rest.mvc.BaseController;
import grape.wx.rest.mp.user.form.MpUserLocationRecordListPageForm;
import grape.wx.rest.mp.user.mapper.MpUserLocationRecordWebMapper;
import grape.wx.rest.mp.user.vo.MpUserLocationRecordVo;
import grape.wx.service.mp.user.api.IMpUserLocationRecordService;
import grape.wx.service.mp.user.po.MpUserLocationRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
 * <p>
 * 公众号微信用户位置记录 前端控制器
 * </p>
 *
 * @author yangwei
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/wx/mpuserlocationrecord")
@Api(tags = "公众号微信用户位置记录相关接口")
public class MpUserLocationRecordController extends BaseController<MpUserLocationRecordVo, MpUserLocationRecord> {

    @Autowired
    private MpUserLocationRecordWebMapper currentWebMapper;
    @Autowired
    private IMpUserLocationRecordService currentService;
    

     @ApiOperation("根据ID查询公众号微信用户位置记录")
     @PreAuthorize("hasAuthority('mpuserlocationrecord:single:queryById')")
     @GetMapping("/{id}")
     @ResponseStatus(HttpStatus.OK)
     public MpUserLocationRecordVo queryById(@PathVariable String id) {
         return super.queryById(id);
     }

     @ApiOperation("删除公众号微信用户位置记录")
     @PreAuthorize("hasAuthority('mpuserlocationrecord:single:deleteById')")
     @DeleteMapping("/{id}")
     @ResponseStatus(HttpStatus.NO_CONTENT)
     public boolean deleteById(@PathVariable String id) {
         return super.deleteById(id);
     }

     
    @ApiOperation("分页查询公众号微信用户位置记录")
    @PreAuthorize("hasAuthority('mpuserlocationrecord:single:listPage')")
    @GetMapping("/listPage")
    @ResponseStatus(HttpStatus.OK)
    public IPage<MpUserLocationRecordVo> listPage(MpUserLocationRecordListPageForm listPageForm) {
         MpUserLocationRecord po = currentWebMapper.formToPo(listPageForm);
         return super.listPage(po,listPageForm);
     }

}
